# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file '弹出5种不同的对话框.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2 import QtGui, QtCore, QtWidgets
from PySide2.QtWidgets import QMessageBox
import sys


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(800, 599)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.pushButton = QPushButton(self.centralwidget)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setGeometry(QRect(300, 120, 93, 28))
        self.pushButton_2 = QPushButton(self.centralwidget)
        self.pushButton_2.setObjectName(u"pushButton_2")
        self.pushButton_2.setGeometry(QRect(300, 200, 93, 28))
        self.pushButton_3 = QPushButton(self.centralwidget)
        self.pushButton_3.setObjectName(u"pushButton_3")
        self.pushButton_3.setGeometry(QRect(300, 280, 93, 28))
        self.pushButton_4 = QPushButton(self.centralwidget)
        self.pushButton_4.setObjectName(u"pushButton_4")
        self.pushButton_4.setGeometry(QRect(300, 350, 93, 28))
        self.pushButton_5 = QPushButton(self.centralwidget)
        self.pushButton_5.setObjectName(u"pushButton_5")
        self.pushButton_5.setGeometry(QRect(300, 420, 93, 28))
        MainWindow.setCentralWidget(self.centralwidget)

        # 关联“消息框”按钮的方法
        self.pushButton.clicked.connect(self.info)
        # 关联“警告框”按钮的方法
        self.pushButton_2.clicked.connect(self.warn)
        # 关联“问答框”按钮的方法
        self.pushButton_3.clicked.connect(self.question)
        # 关联“错误框”按钮的方法
        self.pushButton_4.clicked.connect(self.critical)
        # 关联“关于框”按钮的方法
        self.pushButton_5.clicked.connect(self.about)

        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 800, 26))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)
    # setupUi

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"\u5f39\u51fa5\u79cd\u4e0d\u540c\u7684\u5bf9\u8bdd\u6846", None))
        self.pushButton.setText(QCoreApplication.translate("MainWindow", u"\u6d88\u606f\u6846", None))
        self.pushButton_2.setText(QCoreApplication.translate("MainWindow", u"\u8b66\u544a\u6846", None))
        self.pushButton_3.setText(QCoreApplication.translate("MainWindow", u"\u95ee\u7b54\u6846", None))
        self.pushButton_4.setText(QCoreApplication.translate("MainWindow", u"\u9519\u8bef\u6846", None))
        self.pushButton_5.setText(QCoreApplication.translate("MainWindow", u"\u5173\u4e8e\u6846", None))
    # retranslateUi
    # 分别为五个按钮添加槽函数
    def info(self):
        QMessageBox.information(MainWindow, "消息", "这是一个消息对话框", QMessageBox.Ok)

    def warn(self):
        QMessageBox.warning(MainWindow, "消息", "这是一个警告对话框", QMessageBox.Ok)

    def question(self):
        QMessageBox.question(MainWindow, "消息", "这是一个问答对话框", QMessageBox.Ok)

    def critical(self):
        QMessageBox.critical(MainWindow, "消息", "这是一个错误对话框", QMessageBox.Ok)

    def about(self):
        QMessageBox.about(MainWindow, "消息", "这是一个关于对话框")


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

